package shape3D;     

import javafx.application.Application;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.shape.*;

// 球体
public class SphereDemo extends Application { 
	private HBox root = new HBox(50);
	private Sphere sphere;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		for(int i=5; i>=1; i--) {
			sphere = new Sphere(50, 7);		// 半径和分区的数量(立体图形由许多分区组成,分区越多图形越光滑)
			sphere.setTranslateZ(i*50);
			root.getChildren().addAll(sphere);
		}
		
		Scene scene = new Scene(root, 700, 400, true);		// 开启3D效果
		scene.setCamera(new PerspectiveCamera());		// 设置相机
		stage.setScene(scene);
		stage.show();
	}
}





